<?php
/*
	Advansed MaNGOS Statistic(AMS)
	-------------------------------------------
	Author: DeusModus
	getmangos.ru
	Version: 1.1
*/
require_once("../lib/phpchartdir.php");
require_once("../inc/config.php");
$pagename = basename (__FILE__,".php");
# SQL statement	
$SQL = "Select max(ONLINE), REALM From uptime2 Group By REALM Order By Year(TimeStamp)";

mysql_connect((MYSQL_HOST.":".MYSQL_PORT),(MYSQL_USERNAME),(MYSQL_PASSWORD));
mysql_select_db((MYSQL_DATABASE));
$result = mysql_query($SQL);

if (!$result) {die(MYSQL_ERROR . mysql_error());}
while ($row = mysql_fetch_row($result)) {
    $maxonline[] = $row[0];
	$realm[] = $row[1];
}

$c = new XYChart(
				 X_CHART_PIXELS,
				 Y_CHART_PIXELS
				 );

$c->setPlotArea(
				X_PLOT_AREA_PIXELS,
				Y_PLOT_AREA_PIXELS,
				WIDTH_PLOT_AREA_PIXELS,
				HEIGHT_PLOT_AREA_PIXELS,
	$c->linearGradientColor(
					START_X_LINEAR_GRADIENT_COLOR,
					START_Y_LINEAR_GRADIENT_COLOR,
					END_X_LINEAR_GRADIENT_COLOR,
					END_Y_LINEAR_GRADIENT_COLOR,
					START_COLOR_LINEAR_GRADIENT_COLOR,
					END_COLOR_LINEAR_GRADIENT_COLOR,
					PERIODIC_LINEAR_GRADIENT_COLOR),
				ALT_BGCOLOR_PLOT_AREA,
				EDGE_COLOR_PLOT_AREA,
				H_GRID_COLOR_PLOT_AREA,
				V_GRID_COLOR_PLOT_AREA
				);

$c->addTitle(
			"".TOP_TITLE." всех Реалмов",
			(TOP_FONT),
			TOP_FONT_SIZE,
			TOP_FONT_COLOR,
			TOP_FONT_BGCOLOR,
			TOP_FONT_EDGE_COLOR
			);


$layer = $c->addBarLayer3($maxonline);
$c->setRoundedFrame();
$layer->setBorderColor(Transparent, glassEffect(
												LAYER_GLARE_EFFECT,
												LAYER_GLARE_DIRECTION,
												LAYER_GLARE_RAISED_EFFECT
												)
					  );

$c->xAxis->setLabels($realm);

$c->yAxis->setTickDensity(LAYER_TICK_DENSITY_Y);
$c->yAxis->setTitle(
					(Y_AXIS_TITLE),
					(Y_AXIS_TITLE_FONT),
					 Y_AXIS_TITLE_FONT_SIZE
					 );

$c->xAxis->setTitle(
					(X_AXIS_TITLE),
					(X_AXIS_TITLE_FONT),
					 X_AXIS_TITLE_FONT_SIZE
					 );

$c->xAxis->setColors(Transparent);
$c->yAxis->setColors(Transparent);
$c->xAxis->setLabelStyle((X_AXIS_LABLE_FONT), X_AXIS_LABLE_FONT_SIZE);
$c->yAxis->setLabelStyle((Y_AXIS_LABLE_FONT), X_AXIS_LABLE_FONT_SIZE);


$chart1URL = $c->makeSession("chart1");

$imageMap = $c->getHTMLImageMap("summ_year.php", "",
    "title='".HTML_Image_Map."{value|0}'");

include("../inc/saveimagehandler.php");
?>
<img src="getchart.php?<?php echo $chart1URL?>" border="0" usemap="#map1">
<map name="map1">
<?php echo $imageMap?>
</map>